// stores/menu.js
import { defineStore } from 'pinia'
import { getMainMenuAll } from '@/api'

export const useMenuStore = defineStore('menu', {
  state: () => ({
    menu: null as any[] | null
  }),
  actions: {
    setMenuList(menu) {
      this.menu = menu
    },
    getMenuList() {
      return getMainMenuAll({}).then((res: any) => {
        if (res.code == 200) {
          this.menu = res.data
        }
      })
    }
  },
  persist: true
})
